<?php

	include_once("./global.php");
	session_start();
	if($_SESSION[id]){
		$url = $_SERVER['REQUEST_URI'];
		$url_arr = parse_url($url);
		parse_str($url_arr['query'],$url_arr);
		$member_id = $url_arr[id];
		
		$sql = "select * from userinfo where U_UID = '$member_id'";
		$query = $mysqli->query($sql);
		$result = $query->fetch_assoc();
		
		if(isset($_POST['update_user'])){
			$sql_update = "update userinfo set `U_Loginid` = '$_POST[user_loginid]',`U_Integral` = '$_POST[user_integral]',`U_Consume` = '$_POST[user_consume]' where U_UID = '$member_id'";
			$query_update = $mysqli->query($sql_update);
			if($query_update){
				echo "<script>alert('修改成功')</script>";			
			}else{
				echo $mysqli->error;
				echo "<script>alert('修改失败')</script>";
			}
			echo "<meta http-equiv=\"refresh\" content=\"1; url='admin_member_mangerment.php?page=1' />";
		}
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台首页</title>
<style>
	body{ background:#e7e7e7; margin:0; padding:0;}
	#container{ width:980px; height:auto; position:relative; margin:0 auto;}
	#container #header{ width:980px; height:90px; position:relative; background:#000; line-height:90px;color:#fff; font-size:24px; text-align:center;}
	.left{width:250px; height:auto; position:relative; float:left;}
	.left table{width:248px; height:auto; position:relative; float:left; background:#fff;}
	.left table td{ height:20px; text-align:center;}
	.left table .selected{ background:#73abe3;}
	#content{ width:730px; height:100%; position:relative; float:left; margin:2px 0px;}
	#content .title{ width:720px; height:25px; position:relative; float:left; line-height:25px; font-size:18px; color:#fff; background:#000;}
	form{margin:20px auto; width:720px; height:auto; position:relative; float:left;}
	form .inpuarea{ width:360px; height:150px;}
</style>
</head>
<body>
	<div id="container">
		<div id="header">
			818苹果站后台管理
		</div>
		<div class="left">
			<table>
				<tr><td style="background:#000000; color:#fff;">站点管理</td></tr>
				<tr><td><a href="admin_site_mangerment.php">全局管理</a></td></tr>
				<tr><td>静态页面管理</td></tr>
				<tr><td><a href="admin_link_mangerment.php?page=1">友情链接管理</a></td></tr>
				<tr><td class="selected"><a href="admin_member_mangerment.php?page=1">会员管理</a></td></tr>
				<tr><td><a href="admin_tags_mangerment.php?page=1">标签管理</a></td></tr>
				<tr><td><a href="admin_search_mangerment.php">搜索管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">文章管理</td></tr>
				<tr><td><a href="admin_category_mangerment.php">文章分类管理</a></td></tr>
				<tr><td><a href="admin_news_add.php">发布文章</a></td></tr>
				<tr><td><a href="admin_news_mangerment.php?page=1">文章管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">应用管理</td></tr>
				<tr><td><a href="admin_appcate_mangerment.php">应用分类管理</a></td></tr>
				<tr><td><a href="admin_app_add.php">添加应用</a></td></tr>
				<tr><td><a href="admin_app_mangerment.php?page=1">应用管理</a></td></tr>
				<tr><td><a href="admin_app_collection.php">应用采集</a></td></tr>
				<tr><td><a href="admin_app_collection_single.php">单应用采集</a></td></tr>
			</table>
		</div>
	<div id="content">
		<div class="title">会员管理</div>
<!--		<form>
		<table style="border-bottom:1px solid #000; width:728px;">
			<tr>
				<td style="width:70px;"><label>友链标题</label></td><td><input type="text" name="link_title" /></td>
			</tr>
			<tr>
				<td style="width:70px;"><label>友链地址</label><td><input class="input" type="text" name="link_url" /></td>
			</tr>
			<tr>
				<td><input type="submit" name="insert_link" value="提交" /></td>
			</tr>
		</table>
		</form>-->
		<form action="" method="post">
		<table style="width:750px;">
			<tr style="width:750px;">会员列表</tr>
			<tr>
				<td style="width:70px;">会员登录名</td>
				<td style="width:120px;">会获得积分</td>
				<td style="width:120px;">会员消费积分</td>
				<td style="width:120px;">会员剩余积分</td>
			</tr>
			<tr>
            	<td><input type="text" name="user_loginid"  value="<?php echo $result['U_Loginid']?>" /></td>
				<td><input type="text" name="user_integral" value="<?php echo $result['U_Integral']?>" /></td>
				<td><input type="text" name="user_consume" value="<?php echo $result['U_Consume']?>" /></td>
				<td><input type="text" name="user_jifen" value="<?php $huafei = $result['U_Integral']-$result['U_Consume'];echo $huafei;?>" /></td>
			</tr>
				<td>
					<input type="submit" name="update_user" value="提交修改" />
				</td>
			</tr>
		</table>
		</form>
	</div>
    </div>
</body>
</html>